"""
2022  B圈新版课程 | 邢不行
author: 邢不行
微信: xbx6660
"""
import ccxt

get_kline_num = 99  # 每次请求接口获取的k线数量(如果k线不足，该币种不参与交易)
price_slippage = 0.002  # 下单时的容错值

# =====币种黑名单(不参与交易)
black_list = ['BTCDOMUSDT', 'DEFIUSDT']

# =====策略配置
strategy = {
    "factor_name": "basic",
    "leverage": 2,  # 总资金杠杆数(一定要小于页面杠杆)
    "hold_period": "6H",
    "factors": [
        ('Bias', False, [21], 0.5),
        ('Cci', False, [34], 0.5)
    ],
    "filter_list": [
        ('TakerBuy', [8])
    ],
    "select_coin_num": 1,
    "offset_list": [0, 2, 4]
}
# 将策略配置的因子信息，转换成统一格式，方便后续df操作
feature_set = set()
for factor_name, if_reverse, parameter_list, weight in strategy['factors']:
    feature_set.add(f'{factor_name}_{str(parameter_list)}')
# 将set转成list
feature_list = list(feature_set)

# 将策略配置的过滤信息，转换成统一格式，方便后续df操作
filter_set = set()
for factor_name, parameter_list in strategy['filter_list']:
    filter_set.add(f'{factor_name}_{str(parameter_list)}')
# 将set转成list
filter_list = list(filter_set)

# =====交易所配置
proxy = {'http': 'http://127.0.0.1:7890', 'https': 'http://127.0.0.1:7890'}
exchange = ccxt.binance({
    # mpharaoh666888账户
    'apiKey': "IWutqYrDM6PNgMDyaJMzq1SvEeZONxJkVIKe59rmEdafZ327GMXUmQDMC9zxO8G9",
    'secret': "NmzBMlndNRyJfsXj8YjnXeuDYDqk1WYZUkDK38U3FOzYih8ZZnTmC5LzsX724Pq5",
    # 子账户1
    # 'apiKey': "KEpPzFyDarNnvlpKZkGdKwgbvhklPmY5weNdCHKnPr7MSRgvrYRB9adkci9bt0Rt",
    # 'secret': "Woyr1ItlOYvO30x9ubW8i0fM2XBo1f2adLh8fnonoaJAaGQyJAz22BGoiW8ikGZl",
    'timeout': 30000,
    'rateLimit': 10,
    'enableRateLimit': False,
    'options': {
        'adjustForTimeDifference': True,
        'recvWindow': 10000,
    },
    # 'proxies': proxy
})

# =====钉钉配置
# test群
webhook = 'daea72c7ee0441bcdef0ed84669c19133b964214290f400cf85e2cbbc225ace6'  # 钉钉机器人的webhook
secret = 'SEC796c837660ff64295b9441fedd00604194fdc7613f0ecd3dce40adb57861b827'  # 钉钉机器人的密钥

# 中性策略群
# webhook = '4281ca82db91986c58dd91b388f2d53c1504af1ab67b73f6a2ee8e1f4711716f'  # 钉钉机器人的webhook
# secret = 'SECd63e16dcb7bd239fde99505f0801ab86ed4e51f6720413d33c9371417b1d7d8b'  # 钉钉机器人的密钥
